﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.CompanyListModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%if (Model.Companies != null && Model.Companies.Count > 0)
     {
         var first = Model.Companies[0]; %> 
<div class="bor_cor content mar_t" style="overflow:hidden;">
    <div class="heading_bar">
        <div class="heading_bar_tit">
            <a href="/company/directories/<%=Model.CompanyType.ID %>"><%=Html.Encode(Model.CompanyType.Name) %></a>
        </div>    
    </div>
    <div class="xtt"><a href="/company/directories/<%=Model.CompanyType.ID %>">Xem tất cả</a></div>
    <div class="heading_bar_line"></div>
    <div class="tt_pad ">
        <div class="tt_img">
            <a href="/company/more/<%=first.ID %>">
                <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 200, 138, first.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                <img src="<%=imgPath %>" title="<%=first.Name %>" alt="<%=first.Name %>" class="bor_img" width="200" height="138" style="overflow:hidden"/>
            </a>
        </div>        
        <div class="tt_cnt">
            <h2><a href="/company/more/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Name) %>" class="link_org"><%=Html.Encode(first.Name) %></a></h2>
            <div class="datetime">
                <%=first.AddDate.ToString("HH:mm") %>&nbsp; | <%=first.AddDate.ToString("dd/MM/yyyy") %>&nbsp;|&nbsp;<%=Html.Encode(first.ShortName) %>
            </div>
            <div>
                <div class="itemright">
                    <p><b>Địa chỉ: </b><%=Html.Encode(first.Address)%></p>
                    <p><b>Điện thoại: </b><%=Html.Encode(first.Phone)%></p>
                    <p><b>Email: </b><%=Html.Encode(first.Email)%></p>
                </div>
            </div>
        </div>
    
        <div class="clear"></div>
        <div style="display:block; overflow:hidden">       
            <div class="tt_2col_l pad">        
                <%var total = Model.Companies.Count - 1;
                  int totaRight = total / 2;
                  int totalLeft = total -totaRight;
                  if (totalLeft > 0)
                { %>
       	          <%for (int i = 1; i < totalLeft+1; i++)
                    {
                        string imgPath1 = (Model.Companies[i].ImagePath != null && Model.Companies[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Companies[i].ID, 70, 56, Model.Companies[i].ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
                     %>
       	                <div class="tt_2col_img">
       	                    <a href="/company/more/<%=Model.Companies[i].ID %>/<%=Html.ToUrlFriendly(Model.Companies[i].Name) %>">
                                <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Companies[i].Name %>" alt="<%=Model.Companies[i].Name %>" width="70" height="56" />
                            </a>
       	                </div>
       	                <div class="tt_2col_cnt">
       	                    <a href="/company/more/<%=Model.Companies[i].ID %>/<%=Html.ToUrlFriendly(Model.Companies[i].Name) %>"><%=Html.Encode(Model.Companies[i].Name)%></a>
       	                </div>
       	                <div class="clear"></div>            
                   <%} %>
              <%} %>
            </div>
            <div class="tt_2col_r pad">
                <%if (totaRight > 0)
                { %>
       	          <%for (int i = 1 + totalLeft; i < Model.Companies.Count; i++)
                    {
                         string imgPath1 = (Model.Companies[i].ImagePath != null && Model.Companies[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Companies[i].ID, 70, 56, Model.Companies[i].ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
                     %>
       	                <div class="tt_2col_img">
       	                    <a href="/company/more/<%=Model.Companies[i].ID %>/<%=Html.ToUrlFriendly(Model.Companies[i].Name) %>">
                                <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Companies[i].Name %>" alt="<%=Model.Companies[i].Name %>" width="70" height="56" />
                            </a>
       	                </div>
       	                <div class="tt_2col_cnt">
       	                    <a href="/company/more/<%=Model.Companies[i].ID %>/<%=Html.ToUrlFriendly(Model.Companies[i].Name) %>"><%=Html.Encode(Model.Companies[i].Name)%></a>
       	                </div>
       	                <div class="clear"></div>                    
                   <%} %>
              <%} %>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>
<%} %>
<div class="clear"></div>
